﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WellBuilt.Model;

namespace WellBuilt.Service
{
    public class CementPasteService
    {
        internal static CementPasteOut CementPasteResult(CementPasteIn cementPasteIn)
        {
            CementPasteOut cementPasteOut = new CementPasteOut();

            double C2 = cementPasteIn.WaterDensity;
            double C3 = cementPasteIn.CementDensity;
            double A6 = cementPasteIn.Water;
            double B6 = cementPasteIn.Cement;

            cementPasteOut.WaterCementRatioLaw = cementPasteIn.Water + ":" + cementPasteIn.Cement;
            double C6 = Math.Round(1 / (1 / C2 + B6 / A6 / C3), 2);
            cementPasteOut.YL_Water = C6;
            double D6 = Math.Round(C6 * B6 / A6, 2);
            cementPasteOut.YL_Cement = D6;
            double E6 = D6 + C6;
            cementPasteOut.YL_SpecificGravity = E6;
            double B12 = cementPasteIn.ZJ_λ;
            double B13 = cementPasteIn.ZJ_R;
            double B14 = cementPasteIn.ZJ_H;
            double B15 = cementPasteIn.ZJ_η;
            double B16 = cementPasteIn.ZJ_β;
            double B17 = cementPasteIn.ZJ_M;
            double F9 = Math.Round(B12 * Math.PI * Math.Pow(B13, 2) * B14 * B15 * B16 / B17 / 100, 3);
            cementPasteOut.ZJL = F9;
            double G11 = Math.Round(D6 * F9, 2);
            cementPasteOut.SNYL = G11;

            return cementPasteOut;
        }
    }
}
